<extend name="Public/base"/>



<block name="body">

    <div class="main-title">

        <h2>课程审批管理 </h2>

    </div>
    <div class="cf">
        <span class=""><h3></h3></span>
        <span>今日过审的用户数：{$today_pass_user}，</span><span>今日审批的课程数：{$today_op_course}</span>
        <span>总上架用户数：{$user_count}，</span><span>总上架课程数：{$all_course}</span>
    </div>
    <br>

    <div class="cf">

        <a class="btn p0" href="__CONTROLLER__/index/passed/0">待审核</a>

        <a class="btn p1" href="__CONTROLLER__/index/passed/1">已通过</a>

        <a class="btn p2" href="__CONTROLLER__/index/passed/2">未通过</a>

		

		<?php if($_GET['passed'] == 0){?>

		<a class="btn p2" href="javascript:void(0);" onclick="batch_psd()">批量审核</a>

		<?php }?>

        <!-- 高级搜索 -->

        <!-- <div class="search-form fr cf">

            <div class="sleft">

                <input type="text" name="title" class="search-input" value="{:I('title')}" placeholder="请输入菜单名称">

                <a class="sch-btn" href="javascript:;" id="search" url="__SELF__"><i class="btn-search"></i></a>

            </div>

        </div> -->

    </div>



    <div class="data-table table-striped">

        <form class="ids">

            <table>

                <thead>

                    <tr>

                        <th class="row-selected">

                            <input class="checkbox check-all" type="checkbox">

                        </th>

                        <th>发布者昵称</th>

                        <th>课程分类</th>

                        <th>课程名称</th>

                        <th>课程内容</th>

                        <th>时薪(元/小时)</th>

                        <th>提交时间</th>

                        <th>操作</th>

                    </tr>

                </thead>

                <tbody>

				<notempty name="lists">

                <volist name="lists.0" id="v">

                    <tr>

                        <td><input class="ids row-selected" type="checkbox" name="ids[]" value="{$v.id}"></td>

                        <td>
                            <a href="__MODULE__/UserMember/userdetails/id/{$v.uid}">{$v.nickname}</a>

                        </td>

                        <td><eq name="v.teaching" value="1">想学<else/>想教</eq></td>

                        <td>{$v.title}</td>

                        <td>{$v.content}</td>

                        <td>{$v.salary}</td>

                        <td>{$v.create_time|date='Y/m/d H:i:s',###}</td>

                        <td>

                            <a class="oper" href="javascript:;" data="{$v.id}" val='1' flag="passed">

                                <neq name="Think.get.passed" value="1">通过</neq>

                            </a>

                            <a class="oper" href="javascript:;" data="{$v.id}" val='2' flag="passed">

                                <eq name="Think.get.passed" value="0">不通过</eq>

                            </a>

                            <a class="oper" href="javascript:;" data="{$v.id}" val='0' flag="status"><neq name="Think.get.passed" value="0">删除</neq></a>

                        </td>

                    </tr>

                </volist>

				<else/>

				<td colspan="10" class="text-center"> aOh! 暂时还没有内容! </td>

				</notempty>

                </tbody>

            </table>

        </form>

        <!-- 分页 -->

        <div class="page">

            {$lists.1}

        </div>

    </div>

</block>



<block name="script">

    <script type="text/javascript">

        $(function() {

            $('.oper').click(function(){

                var mes = $(this).html();

                if (confirm('确定要操作吗？')) {

                    var id = $(this).attr('data');

                    var val = $(this).attr('val');

                    var flag = $(this).attr('flag');

                    $.post('__CONTROLLER__/edit', {'id': id,'val':val, 'flag':flag}, function(msg) {

                        alert(msg);

                        location.reload();

                    });

                }

            });



            //记录按钮默认颜色

            $('.p' + "{$Think.get.passed}").css('background','#0c7dac');



            //搜索功能

            // $("#search").click(function() {

            //     var url = $(this).attr('url');

            //     var query = $('.search-form').find('input').serialize();

            //     query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');

            //     query = query.replace(/^&/g, '');

            //     if (url.indexOf('?') > 0) {

            //         url += '&' + query;

            //     } else {

            //         url += '?' + query;

            //     }

            //     window.location.href = url;

            // });

            //回车搜索

            $(".search-input").keyup(function(e) {

                if (e.keyCode === 13) {

                    $("#search").click();

                    return false;

                }

            });



            //导航高亮

            highlight_subnav('{:U('index')}');

    

        });

		

		/*批量审核*/

		function batch_psd(){

	

			obj = document.getElementsByName("ids[]");

			check_val = [];

			for(k in obj){

				if(obj[k].checked)

					check_val.push(obj[k].value);

			}



			if(check_val == "" || check_val == null){

			

				alert("请选择要操作的数据！");

				return;

			

			}else{

			

		

				

			/*ajax*/

			$.post('__CONTROLLER__/ajaxedit', {'ids': check_val,'val':"1", 'flag':"passed"}, function(msg) {

                alert(msg);

                location.reload();

            });



			

			}



		}



    </script>

</block>